const { http } = require('../utils/request');

//	将 code 交给后端 获取 token
exports.wxLogin = async function(data = {}) {
	return await http.post('/wechat/api/getSessionOpenId', {
		data: data,
		isLogin: true	//	登录就不需要判断token了
	})
}

//  获取 code
exports.getCode = function () {
	return new Promise((resolve, reject) => {
		wx.login({
			success: (res) => {
        resolve(res.code);
			},
			fail: reject
		})
	})
}